// 引入路由
const router = require('koa-router')()
router.prefix('/corp')
const query=require('../db/my')
router.get('/', function (ctx, next) {
    ctx.body = 'this is a users response!'
})


router.get('/cList',async (ctx)=>{
  const res = await query(`SELECT *
  FROM corp
  JOIN corpdetail ON corp.cdetailNumber = corpdetail.id;`)
  console.log(res)
  ctx.body = {
    code:200,
    msg:'获取数据成功',
    data:res,
  }
})






// // 删除客户拜访信息
// router.post('/delkehu', async (ctx) => {
//     const { key } = ctx.request.body
//     let keyOne=Number(key)
//     console.log(key,'------key');
//     let res1 = await query(`delete from baifang where id=${keyOne}`)
//     ctx.body = {
//       code: 200,
//       msg: "删除成功",
//     }
//   })
//   router.get('/dataTwo', async (ctx) => {
//     let res1 = await query(`select * from baifang`)
//     ctx.body = {
//       code: 200,
//       msg: "成功",
//       data: res1,
//       // total: total
//     }
//   })
module.exports = router
